<?php

/**************************************************/
class InvoiceFilter {
/**************************************************/
    const FLT_TYPE = "f1";
    const FLT_STATUS = "f2";
    const FLT_DATEFROM = "f3";
    const FLT_DATETO = "f4";
    const FLT_PARTNER = "f5";
    const FLT_AUTHENTICATED = "f6";
    const FLT_PROCESSED = "f7";
    const FLT_PROFORMA = "f8";

    private $type = null;
    private $status = null;
    private $dateFrom = null;
    private $dateTo = null;
    private $partner = null;
    private $authenticated = null;
    private $processed = null;
    private $proForma = null;

    function __construct($filterData) {
        foreach ($filterData as $key=>$value) {
            if ($key == FLT_TYPE) { $type = $value; }
            else if ($key == FLT_STATUS) { $status = $value; }
            else if ($key == FLT_DATEFROM) { $dateFrom = $value; }
            else if ($key == FLT_DATETO) { $dateTo = $value; }
            else if ($key == FLT_PARTNER) { $partner = $value; }
            else if ($key == FLT_AUTHENTICATED) { $authenticated = $value; }
            else if ($key == FLT_PROCESSED) { $processed = $value; }
            else if ($key == FLT_PROFORMA) { $proForma = $value; }
        }
    }
    
    function get() {
        $result = array();
        if ($type) { $result['type'] = $type; }
        if ($status) { $result['status'] = $status; }
        if ($dateFrom) { $result['date-from'] = $dateFrom; }
        if ($dateTo) { $result['date-to'] = $dateTo; }
        if ($partner) { $result['partner'] = $partner; }
        if ($authenticated) { $result['authenticated'] = $authenticated; }
        if ($processed) { $result['processed'] = $processed; }
        if ($proForma) { $result['pro_forma'] = $proForma; }
        return $result;
    }
}


?>
